package cn.four.hqServer.modules.transfer.controller;

import java.text.ParseException;
import java.util.List;

import cn.four.hqServer.modules.transfer.dto.TranFlowDto;
import cn.four.hqServer.modules.transfer.vo.TranflowVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;

import cn.four.hqServer.common.entity.HqTranUser;
import cn.four.hqServer.common.result.Result;
import cn.four.hqServer.common.utils.DateUtil;
import cn.four.hqServer.modules.transfer.dto.TranDto;
import cn.four.hqServer.modules.transfer.service.ZnbIHqTranUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author znb
 * @since 2023-02-23
 */
@Api(tags = "用户转账")
@Validated
@RestController
@RequestMapping("/transfer")
@CrossOrigin
public class ZnbHqTranUserController {

	@Autowired
	private ZnbIHqTranUserService tranUserService;

	@PostMapping("/account")
	@ApiOperation(value = "用户转账")
	public Result<String> account(@RequestBody @Validated TranDto tranDto) {
		String message = tranUserService.account(tranDto);
		if ("OK".equals(message)) {
			return Result.success("转账成功");
		} else {
			return Result.error(message);
		}
	}

	@PostMapping("/tranflow")
	@ApiOperation(value = "交易流水查询")
	public Result tranflow(@RequestBody @Validated TranFlowDto tranFlowDto) {
		return Result.success(tranUserService.tranflow(tranFlowDto));
	}

	
}
